<?xml version="1.0" encoding="UTF-8"?>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="edu.tsinghua.eea.powermanagement.data.PCDataCell"%>
<%@page import="java.util.Vector"%>
<%@page import="edu.tsinghua.eea.powermanagement.data.PowerConsumptionData"%>
<%@ page language="java" contentType="text/xml; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%
PowerConsumptionData pcd = (PowerConsumptionData)session.getAttribute("xml_PCData");
if(pcd == null){
	out.println("<plug-pcd length='0'>");
	out.println("</plug-pcd>");
} else {
	Vector<PCDataCell> vpcd = pcd.getPCDetail();
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
%>
<plug-pcd length="<%=vpcd.size() %>" total="<%=pcd.getPowerTotal() %>">
<%for(int i=0; i<vpcd.size(); i++){ %>
	<plug date="<%=sdf.format(vpcd.get(i).getDate()) %>" power="<%=vpcd.get(i).getPower() %>" />
<%} %>
</plug-pcd>
<%} %>
